﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using Exhibition.Common;
using Exhibition.Service;
using Exhibition.Common.Extension;
namespace Exhibition.Handler
{
    /// <summary>
    /// CommonHandler 的摘要说明
    /// </summary>
    public class CommonHandler : IHttpHandler, IReadOnlySessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            AJAXJson rtnMessage = new AJAXJson();
            string opType = context.Request["OpType"];
            var controler = new ControlService(context);
            string msg = string.Empty;
            switch (opType.ToLower())
            {
                case "chkuser":
                    rtnMessage.ResultMessage = controler.ChkUser(); 
                    break;
                case "chkcode":
                    rtnMessage.ResultMessage = controler.ChkCode();
                    break;
                case "getbadge":
                    rtnMessage.ResultMessage = controler.GetBadge();
                    break;
                case "savebadge":
                    rtnMessage.ResultMessage = controler.SaveBadge();
                    break;

                case "delbadge":
                    rtnMessage.ResultMessage = controler.DelBadge();
                    break;

                case "delmessage":
                    rtnMessage.ResultMessage = controler.DelMessage();
                    break;
                case "delnavid":
                    rtnMessage.ResultMessage = controler.DelNavId();
                    break;
                case "del":
                    rtnMessage.ResultMessage = controler.DelCommData();
                    break;
                case "updateemail":
                    rtnMessage.ResultMessage = controler.UpdateEmail();
                    break;

                case "updatephone":
                    rtnMessage.ResultMessage = controler.UpdatePhone();
                    break;
                case "getsonarea":
                    rtnMessage.ResultMessage = controler.GetSonArea();
                    break;
                case "savearea":
                    rtnMessage.ResultMessage = controler.SaveArea();
                    break;
                 
            }
            context.Response.ContentType = "text/json;charset=UTF-8;";
            context.Response.Write(rtnMessage.ToJsonItem());
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}